const state = {
    comData: {},
    typeStatus:false,
    totalMoney: 0,
    extraPrice:{},
    subCategory:{}
}

const mutations = {
    TOGGLE_COM_DATA: (state, device) => {
        state.comData = device.data
        state.typeStatus = device.typeStatus
    },
    TOGGLE_EXTRA_PRICE: (state, device) => {
        state.extraPrice = device?device:{}
    },
    TOGGLE_SUB_CATEGORY: (state, device) => {
        state.subCategory = device!==null?device:{}
    },
}

const actions = {
    getComData({commit}, device) {
        commit('TOGGLE_COM_DATA', device)
    },
    getExtraPrice({commit}, device){
        commit('TOGGLE_EXTRA_PRICE', device)
    },
    getSubCategory({commit}, device){
        commit('TOGGLE_SUB_CATEGORY', device)
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
